import axios from 'axios';

let base = 'http://localhost:9998';
axios.interceptors.request.use(function (config) {
    config.headers['X-Bable-Session'] = sessionStorage.getItem("X-Bable-Session");
    return config;
}, function (error) {
    console.error(error);
    return Promise.reject(error);
});


export const requestLogin = params => { return axios.post(`${base}/api/login`, params).then(res=>res); };

export const getUserList = params => { return axios.get(`${base}/user/list`, { params: params }); };

export const getUserListPage = params => { return axios.get(`${base}/user/listpage`, { params: params }); };

export const removeUser = params => { return axios.get(`${base}/user/remove`, { params: params }); };

export const batchRemoveUser = params => { return axios.get(`${base}/user/batchremove`, { params: params }); };

export const editUser = params => { return axios.get(`${base}/user/edit`, { params: params }); };

export const addUser = params => { return axios.get(`${base}/user/add`, { params: params }); };